<?php

declare (strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://doc.hyperf.io
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
 */
namespace App\Task;

use App\Constants\WsMessage;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Task\Annotation\Task;
use function App\Helper\wsSuccess;
class FriendTask_698b76b6edc64537ca22b778f1b0e0de extends FriendTask
{
    use \Hyperf\Di\Aop\ProxyTrait;
    /**
     * @Inject()
     * @var \Hyperf\WebSocketServer\Sender
     */
    private $sender;
    /**
     * @Task()
     * @param int   $fd
     * @param array $data
     */
    public function agreeApply(int $fd, array $data)
    {
        $__function__ = __FUNCTION__;
        $__method__ = __METHOD__;
        return self::__proxyCall(FriendTask::class, __FUNCTION__, self::getParamsMap(FriendTask::class, __FUNCTION__, func_get_args()), function (int $fd, array $data) use($__function__, $__method__) {
            $result = wsSuccess(WsMessage::WS_MESSAGE_CMD_EVENT, WsMessage::EVENT_FRIEND_AGREE_APPLY, $data);
            $this->sender->push($fd, $result);
        });
    }
    /**
     * @Task()
     * @param $fd
     * @param $username
     * @param $avatar
     * @param $userId
     * @param $type
     * @param $content
     * @param $cid
     * @param $mine
     * @param $fromId
     * @param $timestamp
     *
     * @return bool
     */
    public function sendMessage($fd, $username, $avatar, $userId, $type, $content, $cid, $mine, $fromId, $timestamp)
    {
        $__function__ = __FUNCTION__;
        $__method__ = __METHOD__;
        return self::__proxyCall(FriendTask::class, __FUNCTION__, self::getParamsMap(FriendTask::class, __FUNCTION__, func_get_args()), function ($fd, $username, $avatar, $userId, $type, $content, $cid, $mine, $fromId, $timestamp) use($__function__, $__method__) {
            if (!$fd) {
                return false;
            }
            $data = ['username' => $username, 'avatar' => $avatar, 'id' => $userId, 'type' => $type, 'content' => $content, 'cid' => $cid, 'mine' => $mine, 'fromid' => $fromId, 'timestamp' => $timestamp];
            $result = wsSuccess(WsMessage::WS_MESSAGE_CMD_EVENT, WsMessage::EVENT_GET_MESSAGE, $data);
            $this->sender->push($fd, $result);
        });
    }
}